<?php
namespace Admin\Transformer;

use Common\ORG\Util\Transformer;

/**
 * Class ItemTransformer
 * @package Home\Transformer
 */
class ItemTransformer extends Transformer {
    public function transformer($item) {
        return [
            'id' => intval($item['id']),
            'name' => strval($item['name']),
            'status' => intval($item['status']),
            'parent_cid' => intval($item['parent_cid']),
            'second_cid' => intval($item['second_cid']),
            'is_enquiry' => intval($item['is_enquiry']),
            'create_time' => date('Y-m-d', $item['create_time']),
            'update_time' => date('Y-m-d', $item['update_time']),
            'put_port' => strval($item['put_port']),
            'put_place' => strval($item['put_place']),
            'parent_name' => isset($item['parent_name'])?$item['parent_name']:'',
            'second_name' => isset($item['second_name'])?$item['second_name']:'',
            'status_desc' => ($item['status']==1)?"正常":"关闭",
            'enquiry_desc' => ($item['is_enquiry']==1)?"是":"否"
        ];
    }
}
